package org.example.java8;

public class DefaultInterface {
    public static void main(String[] args) {
        Car car = new Car();
        car.print();
    }
}

interface Vehicle {
    default void print() {
        System.out.println("我是一辆车!");
    }
}

class Car implements Vehicle {
    //可以不实现print方法
//    public void print() {
//        System.out.println("我是一辆小汽车!");
//    }
}